import requests

from bs4 import BeautifulSoup

cookies = {
    'll': '"108296"',
    'bid': '8JQPwZZT6Do',
    '_pk_ref.100001.8cb4': '%5B%22%22%2C%22%22%2C1698373591%2C%22https%3A%2F%2Fcn.bing.com%2F%22%5D',
    '_pk_id.100001.8cb4': '88afbaf26fd1b464.1698373591.',
    '_pk_ses.100001.8cb4': '1',
    '__utma': '30149280.2145246926.1698373592.1698373592.1698373592.1',
    '__utmc': '30149280',
    '__utmz': '30149280.1698373592.1.1.utmcsr=cn.bing.com|utmccn=(referral)|utmcmd=referral|utmcct=/',
    '__utmt': '1',
    'ap_v': '0,6.0',
    '_ga': 'GA1.2.217034867.1698373596',
    '_gid': 'GA1.2.240010009.1698373596',
    '_ga_Y4GN1R87RG': 'GS1.1.1698373595.1.0.1698373868.0.0.0',
    '__utmb': '30149280.10.10.1698373592',
}

headers = {
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
    'Accept-Language': 'zh-CN,zh;q=0.9',
    'Connection': 'keep-alive',
    # 'Cookie': 'll="108296"; bid=8JQPwZZT6Do; _pk_ref.100001.8cb4=%5B%22%22%2C%22%22%2C1698373591%2C%22https%3A%2F%2Fcn.bing.com%2F%22%5D; _pk_id.100001.8cb4=88afbaf26fd1b464.1698373591.; _pk_ses.100001.8cb4=1; __utma=30149280.2145246926.1698373592.1698373592.1698373592.1; __utmc=30149280; __utmz=30149280.1698373592.1.1.utmcsr=cn.bing.com|utmccn=(referral)|utmcmd=referral|utmcct=/; __utmt=1; ap_v=0,6.0; _ga=GA1.2.217034867.1698373596; _gid=GA1.2.240010009.1698373596; _ga_Y4GN1R87RG=GS1.1.1698373595.1.0.1698373868.0.0.0; __utmb=30149280.10.10.1698373592',
    'Referer': 'https://www.douban.com/',
    'Sec-Fetch-Dest': 'document',
    'Sec-Fetch-Mode': 'navigate',
    'Sec-Fetch-Site': 'same-origin',
    'Sec-Fetch-User': '?1',
    'Upgrade-Insecure-Requests': '1',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36',
    'sec-ch-ua': '"Chromium";v="118", "Google Chrome";v="118", "Not=A?Brand";v="99"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"Windows"',
}
params = {
    'start': '10',
}

response = requests.get('https://movie.douban.com/subject/35256092/reviews', params=params, cookies=cookies, headers=headers)

parser_result = BeautifulSoup(response.text,"html.parser")
review_list = parser_result.find("div", 'review-list').find_all('div','main review-item')

for index,item in enumerate(review_list):
    context = item.find('div','main-bd').find('div','review-short').find('div','short-content').find('p')
    flag_content = None
    if None is not context:
        flag_content = context.text

    content = str(item.find('div', 'main-bd').find('div', 'review-short').find('div', 'short-content').text).replace("(展开)","").strip() + "(展开)"
    if None is not flag_content:
        content = content.split(flag_content)[1].lstrip()

    print(f"{index+1} {content} \n")